﻿using System;
using System.Collections.Generic;
#if DEBUG
using System.Diagnostics;
#endif // #if DEBUG
using System.Linq;
using System.Text;
using System.Data.Objects.DataClasses;

using FRL.DebtChased.Repository.ViewModels;
using FRL.DebtChased.Types;

namespace FRL.DebtChased.Repository
{

	/// <summary>
	/// Extensions to the AccountInvoice model
	/// </summary>
	public partial class AccountInvoice
	{

		/////////////////////////////////////////////////////////////
		// Attributes

		public bool IsProcessingDue
		{
			get
			{
				return (this.NextWorkflowProcessingTime <= DateTime.Now);
			}
		}

		public bool IsInQuery
		{
			get 
			{ 
				return (
					(this.AccountInvoiceStatus != null)
					&&
					(this.AccountInvoiceStatus.IsInQuery)
				);
			}
		}

		/////////////////////////////////////////////////////////////
		// Operations

		public Money ToMoneyDecimal()
		{

			// Compose money decimal
			return new Money(this.AmountValue, Money.ParseCurrencyCode(this.AmountCurrency));

		}

		/////////////////////////////////////////////////////////////
		// Static Operations

	}

}
